#[doc = "Register `SPITXFIFOCR` reader"]
pub struct R(crate::R<SPITXFIFOCR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<SPITXFIFOCR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<SPITXFIFOCR_SPEC>> for R {
    fn from(reader: crate::R<SPITXFIFOCR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `SPITXFIFOCR` writer"]
pub struct W(crate::W<SPITXFIFOCR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<SPITXFIFOCR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<SPITXFIFOCR_SPEC>> for W {
    fn from(writer: crate::W<SPITXFIFOCR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Threshold for triggering a TX FIFO interrupt.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum TXINTSIZE_A {
    #[doc = "0: 1."]
    THRESHOLD_1 = 0,
    #[doc = "1: 4."]
    THRESHOLD_4 = 1,
    #[doc = "2: 8."]
    THRESHOLD_8 = 2,
    #[doc = "3: 16."]
    THRESHOLD_16 = 3,
    #[doc = "4: 32."]
    THRESHOLD_32 = 4,
    #[doc = "5: 64."]
    THRESHOLD_64 = 5,
    #[doc = "6: 128."]
    THRESHOLD_128 = 6,
    #[doc = "7: 192."]
    THRESHOLD_192 = 7,
}
impl From<TXINTSIZE_A> for u8 {
    #[inline(always)]
    fn from(variant: TXINTSIZE_A) -> Self {
        variant as _
    }
}
#[doc = "Field `txintsize` reader - Threshold for triggering a TX FIFO interrupt."]
pub struct TXINTSIZE_R(crate::FieldReader<u8, TXINTSIZE_A>);
impl TXINTSIZE_R {
    pub(crate) fn new(bits: u8) -> Self {
        TXINTSIZE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TXINTSIZE_A {
        match self.bits {
            0 => TXINTSIZE_A::THRESHOLD_1,
            1 => TXINTSIZE_A::THRESHOLD_4,
            2 => TXINTSIZE_A::THRESHOLD_8,
            3 => TXINTSIZE_A::THRESHOLD_16,
            4 => TXINTSIZE_A::THRESHOLD_32,
            5 => TXINTSIZE_A::THRESHOLD_64,
            6 => TXINTSIZE_A::THRESHOLD_128,
            7 => TXINTSIZE_A::THRESHOLD_192,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_1`"]
    #[inline(always)]
    pub fn is_threshold_1(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_1
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_4`"]
    #[inline(always)]
    pub fn is_threshold_4(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_4
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_8`"]
    #[inline(always)]
    pub fn is_threshold_8(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_8
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_16`"]
    #[inline(always)]
    pub fn is_threshold_16(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_16
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_32`"]
    #[inline(always)]
    pub fn is_threshold_32(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_32
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_64`"]
    #[inline(always)]
    pub fn is_threshold_64(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_64
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_128`"]
    #[inline(always)]
    pub fn is_threshold_128(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_128
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_192`"]
    #[inline(always)]
    pub fn is_threshold_192(&self) -> bool {
        **self == TXINTSIZE_A::THRESHOLD_192
    }
}
impl core::ops::Deref for TXINTSIZE_R {
    type Target = crate::FieldReader<u8, TXINTSIZE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `txintsize` writer - Threshold for triggering a TX FIFO interrupt."]
pub struct TXINTSIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> TXINTSIZE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: TXINTSIZE_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "1."]
    #[inline(always)]
    pub fn threshold_1(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_1)
    }
    #[doc = "4."]
    #[inline(always)]
    pub fn threshold_4(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_4)
    }
    #[doc = "8."]
    #[inline(always)]
    pub fn threshold_8(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_8)
    }
    #[doc = "16."]
    #[inline(always)]
    pub fn threshold_16(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_16)
    }
    #[doc = "32."]
    #[inline(always)]
    pub fn threshold_32(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_32)
    }
    #[doc = "64."]
    #[inline(always)]
    pub fn threshold_64(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_64)
    }
    #[doc = "128."]
    #[inline(always)]
    pub fn threshold_128(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_128)
    }
    #[doc = "192."]
    #[inline(always)]
    pub fn threshold_192(self) -> &'a mut W {
        self.variant(TXINTSIZE_A::THRESHOLD_192)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x07 << 3)) | (((value as u16) & 0x07) << 3);
        self.w
    }
}
#[doc = "Configures the burst request of the TX FIFO.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DMATXBRSIZEPCLK_A {
    #[doc = "0: The threshold level is 255."]
    THRESHOLD_255 = 0,
    #[doc = "1: The threshold level is 252."]
    THRESHOLD_252 = 1,
    #[doc = "2: The threshold level is 248."]
    THRESHOLD_248 = 2,
    #[doc = "3: The threshold level is 240."]
    THRESHOLD_240 = 3,
    #[doc = "4: The threshold level is 224."]
    THRESHOLD_224 = 4,
    #[doc = "5: The threshold level is 192."]
    THRESHOLD_192 = 5,
    #[doc = "6: The threshold level is 128."]
    THRESHOLD_128 = 6,
    #[doc = "7: The threshold level is 64."]
    THRESHOLD_64 = 7,
}
impl From<DMATXBRSIZEPCLK_A> for u8 {
    #[inline(always)]
    fn from(variant: DMATXBRSIZEPCLK_A) -> Self {
        variant as _
    }
}
#[doc = "Field `dmatxbrsizepclk` reader - Configures the burst request of the TX FIFO."]
pub struct DMATXBRSIZEPCLK_R(crate::FieldReader<u8, DMATXBRSIZEPCLK_A>);
impl DMATXBRSIZEPCLK_R {
    pub(crate) fn new(bits: u8) -> Self {
        DMATXBRSIZEPCLK_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DMATXBRSIZEPCLK_A {
        match self.bits {
            0 => DMATXBRSIZEPCLK_A::THRESHOLD_255,
            1 => DMATXBRSIZEPCLK_A::THRESHOLD_252,
            2 => DMATXBRSIZEPCLK_A::THRESHOLD_248,
            3 => DMATXBRSIZEPCLK_A::THRESHOLD_240,
            4 => DMATXBRSIZEPCLK_A::THRESHOLD_224,
            5 => DMATXBRSIZEPCLK_A::THRESHOLD_192,
            6 => DMATXBRSIZEPCLK_A::THRESHOLD_128,
            7 => DMATXBRSIZEPCLK_A::THRESHOLD_64,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_255`"]
    #[inline(always)]
    pub fn is_threshold_255(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_255
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_252`"]
    #[inline(always)]
    pub fn is_threshold_252(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_252
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_248`"]
    #[inline(always)]
    pub fn is_threshold_248(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_248
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_240`"]
    #[inline(always)]
    pub fn is_threshold_240(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_240
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_224`"]
    #[inline(always)]
    pub fn is_threshold_224(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_224
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_192`"]
    #[inline(always)]
    pub fn is_threshold_192(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_192
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_128`"]
    #[inline(always)]
    pub fn is_threshold_128(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_128
    }
    #[doc = "Checks if the value of the field is `THRESHOLD_64`"]
    #[inline(always)]
    pub fn is_threshold_64(&self) -> bool {
        **self == DMATXBRSIZEPCLK_A::THRESHOLD_64
    }
}
impl core::ops::Deref for DMATXBRSIZEPCLK_R {
    type Target = crate::FieldReader<u8, DMATXBRSIZEPCLK_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `dmatxbrsizepclk` writer - Configures the burst request of the TX FIFO."]
pub struct DMATXBRSIZEPCLK_W<'a> {
    w: &'a mut W,
}
impl<'a> DMATXBRSIZEPCLK_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DMATXBRSIZEPCLK_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "The threshold level is 255."]
    #[inline(always)]
    pub fn threshold_255(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_255)
    }
    #[doc = "The threshold level is 252."]
    #[inline(always)]
    pub fn threshold_252(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_252)
    }
    #[doc = "The threshold level is 248."]
    #[inline(always)]
    pub fn threshold_248(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_248)
    }
    #[doc = "The threshold level is 240."]
    #[inline(always)]
    pub fn threshold_240(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_240)
    }
    #[doc = "The threshold level is 224."]
    #[inline(always)]
    pub fn threshold_224(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_224)
    }
    #[doc = "The threshold level is 192."]
    #[inline(always)]
    pub fn threshold_192(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_192)
    }
    #[doc = "The threshold level is 128."]
    #[inline(always)]
    pub fn threshold_128(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_128)
    }
    #[doc = "The threshold level is 64."]
    #[inline(always)]
    pub fn threshold_64(self) -> &'a mut W {
        self.variant(DMATXBRSIZEPCLK_A::THRESHOLD_64)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x07) | ((value as u16) & 0x07);
        self.w
    }
}
impl R {
    #[doc = "Bits 3:5 - Threshold for triggering a TX FIFO interrupt."]
    #[inline(always)]
    pub fn txintsize(&self) -> TXINTSIZE_R {
        TXINTSIZE_R::new(((self.bits >> 3) & 0x07) as u8)
    }
    #[doc = "Bits 0:2 - Configures the burst request of the TX FIFO."]
    #[inline(always)]
    pub fn dmatxbrsizepclk(&self) -> DMATXBRSIZEPCLK_R {
        DMATXBRSIZEPCLK_R::new((self.bits & 0x07) as u8)
    }
}
impl W {
    #[doc = "Bits 3:5 - Threshold for triggering a TX FIFO interrupt."]
    #[inline(always)]
    pub fn txintsize(&mut self) -> TXINTSIZE_W {
        TXINTSIZE_W { w: self }
    }
    #[doc = "Bits 0:2 - Configures the burst request of the TX FIFO."]
    #[inline(always)]
    pub fn dmatxbrsizepclk(&mut self) -> DMATXBRSIZEPCLK_W {
        DMATXBRSIZEPCLK_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "SPITXFIFOCR is the SPI TX FIFO control register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [spitxfifocr](index.html) module"]
pub struct SPITXFIFOCR_SPEC;
impl crate::RegisterSpec for SPITXFIFOCR_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [spitxfifocr::R](R) reader structure"]
impl crate::Readable for SPITXFIFOCR_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [spitxfifocr::W](W) writer structure"]
impl crate::Writable for SPITXFIFOCR_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets SPITXFIFOCR to value 0x09"]
impl crate::Resettable for SPITXFIFOCR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0x09
    }
}
